<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/simple',array('name'=>'发布任务','search'=>'N'))}
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data" class="well form-horizontal">
		<input type="hidden" id="ajax" name="ajax" value="0">
		<input type="hidden" id="add_file" name="add_file">
		<input type="hidden" id="executor" name="executor" value="">
		<input type="hidden" id="actor" name="actor" value="">
		<input type="hidden" id="opmode" name="opmode" value="add">
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="name">客户名称：</label>
			<div class="col-sm-8">
				<select id="name" name="name" class="form-control col-15" check="require" msg="请选择客户">
					<option value="" >请选择客户</option>
					{:fill_option($customer_list)}
					<option value="#" >其他</option>
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="account_id">工作类型：</label>
			<div class="col-sm-8">
				<select name="order_type" id="order_type" class="form-control col-12" >
					{:fill_option(get_system_config('WORK_ORDER_TYPE'))}
				</select>
			</div>
		</div>
		<div class="form-group  col-sm-6">
			<label class="col-sm-4 control-label" for="name">负责人：</label>
			<div class="col-sm-8">
				<div id="executor_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_actor();"><i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list"></span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group  col-sm-6">
			<label class="col-sm-4 control-label" for="name">参与人：</label>
			<div class="col-sm-8">
				<div id="actor_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_actor();"><i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list"></span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="request_arrive_time">要求到达时间：</label>
			<div class="col-sm-8">
				<input class="input-date-time form-control" type="text" id="request_arrive_time" name="request_arrive_time" value="" check="require" msg="请输入要求到达时间" readonly="readonly">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="request_finish_time">要求完成时间：</label>
			<div class="col-sm-8">
				<input class="input-date-time form-control" type="text" id="request_finish_time" name="request_finish_time" value=""  check="require" msg="请输入要求完成时间" readonly="readonly">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="content">任务说明：</label>
			<div class="col-xs-10">
				<textarea class="editor" id="content" name="content" style="width:100%;height:300px;" check="require" msg="请输入内容"></textarea>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label" for="name">附件：</label>
			<div class="col-sm-10">
				{:W('FileUpload/add')}
			</div>
		</div>
		<div class="form-group">
			<div class="action col-sm-10 col-sm-offset-2">
				<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
				<input class="btn btn-sm btn-default" type="button" value="取消" onclick="go_return_url();">
			</div>
		</div>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		function save() {
		window.onbeforeunload=null;
		$("#executor").val("");
		$("#executor_wrap span.address_list span").each(function() {
		$("#executor").val($("#executor").val()+$(this).find("b").text()+'|'+$(this).attr("data")+";");
		});
		$("#actor").val("");
		$("#actor_wrap span.address_list span").each(function() {
		$("#actor").val($("#actor").val()+$(this).find("b").text()+'|'+$(this).attr("data")+";");
		});
		sendForm("form_data","{:U('save')}");
		}
		function popup_actor() {
		winopen("{:U('popup/work_order')}",730,574);
		}
		$(document).ready(function() {
		$(document).on("click",".inputbox .address_list a.del", function() {
		$(this).parent().parent().remove();
		});
		});
	</script>
</block>
